package cuiyt.designpattern.observer;


/**
 * @author cyt
 * @create 2020-08-13 13:54
 */
public class ObserverTest {

    public static void main(String[] args) {
        Admin admin = new Admin();
        Customer customer = new Customer();

        Store store = new Store();
        // 商城添加观察者
        store.addProductObserver(admin);
        store.addProductObserver(customer);

        Product product = new Product("cyt","100");
        // 商城添加商品、更新商品。会通知观察者。
        store.addProduct(product);
        store.setProductPrice("cyt", "22");
    }

}
